<script type="text/javascript">
    /*<![CDATA[*/
    jQuery(function($) {
        var width = $(window).width();
        if (width < 950) {
            //$('#page').css('width', width - 2 + 'px');
        }
        if (width > 767) {
            $('#column1-container').addClass('container');
            $('#column1-content').addClass('span9');
            //$('#main2-navbar').addClass('container');
            //$('#page').css('width', width - 2 + 'px');
            /*  $('#footer ').css("text-align","left");*/
            //$("#div-main-logout").css('padding-left', width - 200 + 'px');
            //$("#menu-bar-first-space").hide();
        }
    })
    /*]]>*/
</script>
<?php
/*
$control->beginCache('blyn_layout', array('duration' => 3600,
    'dependency' => array(
        'class' => 'CExpressionDependency',
        'expression' => 'space_' . blyn::app()->getActiveSpace()->getId() . '_application.' . Blyn::app()->getActiveApp()->getId())
))
 * 
 */
?>
<div class="navbar navbar-static-top">
    <div class="navbar-inner">
        <div id="main2-navbar"class="container">                 
            <div style="margin-bottom: -2px"><a class="brand" href="./index.php"> <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/global.jpg" width="25" height="25"  class="img-rounded"> </img>比邻平台</a></div>
            <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
            <!-- Be sure to leave the brand out there if you want it shown -->
            <a class="brand" href="#"></a>
            <div class="nav-collapse collapse">
                <ul class="nav" style="margin-top: 7px">
                    <?php if (Yii::app()->user->isGuest) { ?>
                        <li id="menu-bar-first-space" class="" style="width: 100px">
                            <a href="./index.php"></a>
                        </li>
                        <li class="active">
                            <a href="./index.php"><?php echo Yii::t('site', 'Sign in'); ?></a>
                        </li>
                        <li class="">
                            <a href="./index.php"><?php echo Yii::t('site', 'Sign up'); ?></a>
                        </li>
                    <?php } else { ?>
                        <?php
                        $appLinks = Blyn::app()->getAppUI()->getLinks(TRUE);
                        //$appLinks = Blyn::app()->getAppUI()->getLinks();
                        $mainMenu = $appLinks['mainMenu'];
                        //$mainMenu = Blyn::app()->getAppUI()->getMenu(BUIApp::MAINMENU);
                        $items = $mainMenu;
                        ?>
                        <li class="active"><?php echo $items['mySpace']['ajaxUrl']; ?></li>
                        <li class=""><?php echo $items['mySpaces']['ajaxUrl']; ?></li>
                        <li class=""><?php echo $items['SpaceStore']['ajaxUrl']; ?></li>
                        <li class="">
                            <a href='<?php echo $items['logOut']['url']; ?>'><?php echo $items['logOut']['label']; ?></a>
                        </li>                               
                    <?php } ?>
                </ul>
            </div>
        </div>
    </div>
</div>   
<?php //$control->endCache() ?>

<div style="margin-left: -19px;margin-right: -19px;">
    <?php
    //$control->setAjaxContainerView('blyn_container');
    //Blyn::app()->getUIManager()->render();
    $control = Blyn::app()->getUIManager();
    $views = $control->getViews();

    foreach ($views as $view) {
        if (is_array($view)) {
            $viewName = isset($view['view']) ? $view['view'] : (isset($view[0]) ? $view[0] : NULL);
            $viewData = isset($view['data']) ? $view['data'] : (isset($view[1]) ? $view[1] : $control);
        }
        if (is_string($view)) {
            $viewName = $view;
            $viewData = $control;
        }
        if ($viewName != NULL)
            $control->renderView($viewName, $viewData, NULL);
    }

    $controlChildren = $control->getChildrenOfControl();

    foreach ($controlChildren as $name => $control) {
        $control->render();
    }
    ?>
</div>

